--[[
*
* 我方场上英雄比敌方每多一名，我方所有单位增加10%攻击力
]]
---@class BuffEffect300031000:BaseBuffEffect
BuffEffect300031000 = ClientFight.CreateClass("BuffEffect300031000", ClientFight.BaseBuffEffect)
local t = BuffEffect300031000
---@param fight Fight
---@param buff FighterBuff
function t:add(fight, buff)
    local add = ClientFight.BaseBuffEffect.add(self, fight, buff, false);
    t:action(fight, buff);--直接触发一次, 计算属性
    return add;
end

---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)
    local target = buff.target;
    local others = FighterUtils.getOthersBy(target, true, nil, false);
    local ours = FighterUtils.getOursBy(target, true, nil, false);
    local change = table.getn(ours) - table.getn(others);
    if (change > 0) then
        if (buff.buffBean.f_Atribute ~= nil) then
            for value in paris(buff.buffBean.f_Atribute) do
                buff.attributes.attributes[value[1]] = value[2] * change;
                SkillRoleMgr.savePathFile(string.format("[%s][EFFECT]Fighter %s buff%s 我方场上英雄比敌方每多一名，我方所有单位增加N攻击力, 增加倍数 %s",
                        fight.frame, target.fighterId, buff.modelId, change));
            end
        end
    else
        buff.attributes.attributes = {};
    end
    ClientFight.BaseBuffEffect.action(self, fight, buff, ...);
    return IBuffEffect.SUCCESS_ATTRI_HAS_CHANGE;
end
t.New()